#include <scene.h>
#include <button.h>
#include <scene_manager.h>
#include <iostream>

class SceneSatrt : public Scene{
private:
    SceneManager& sceneManager;
    Font* font;
    Vector2 titleWH;
public:
    TextButton btn_goto_randmap;
    TextButton btn_goto_gaming;
    TextButton btn_goto_GAME;
    TextButton btn_goto_raycasting;
    TextButton btn_goto_east;

    SceneSatrt(SceneManager& manager, Font* font) :sceneManager(manager),font(font) {
        int baseleft = (GetScreenHeight()-5*150-20*4)/2 + 170*2;
        int basetop = (GetScreenHeight())/2 + 100;
        btn_goto_randmap = {font,baseleft, basetop,150,100,"randmap"};
        btn_goto_randmap.setOnClick([&](){sceneManager.switchTo("randmap");});

        btn_goto_gaming = {font,baseleft + 170 ,basetop,150,100,"gaming"};
        btn_goto_gaming.setOnClick([&](){sceneManager.switchTo("gaming");});

        btn_goto_GAME = {font,baseleft + 170 *2,basetop,150,100,"GAME"};
        btn_goto_GAME.setOnClick([&](){sceneManager.switchTo("Game");});
        
        btn_goto_raycasting = {font,baseleft + 170 *3 ,basetop, 150,100,"raycasting"};
        btn_goto_raycasting.setOnClick([&](){sceneManager.switchTo("raycasting");});

        btn_goto_east = {font,baseleft + 170 *4 ,basetop, 150,100,"east"};
        btn_goto_east.setOnClick([&](){sceneManager.switchTo("east");});
    };
    ~SceneSatrt() {}

    void init() override{}

    void render(float dt) override {
        ClearBackground(WHITE);

        titleWH = MeasureTextEx(*font, "MAZE", 64, 0);
        DrawTextEx(*font, "MAZE", {GetScreenWidth()/2-titleWH.x/2, (float)GetScreenHeight()/2 - 200}, 64, 0, BLACK);
        btn_goto_randmap.render();
        btn_goto_gaming.render();
        btn_goto_GAME.render();
        btn_goto_raycasting.render();
        btn_goto_east.render();
    }
};